<template>
    <div class="acceptance-registration-pages">
        <commpVxeTable
         :config="dataTableConfig" 
         :columns="columnsVxe" 
         :formItem="formItem"
         @checkboxChange="checkboxChange"
         ref="acceptanceRegistrationRef"
         @searchEvent="searchEvent"
         @resetEvent="resetEvent"
         >
            <template v-slot:startTime_time>
                <a-date-picker v-model:value="formItemData.startTime" />
            </template>
            <template v-slot:endTime_time>
                <a-date-picker v-model:value="formItemData.endTime" />
            </template>
            <template v-slot:operation_btn="{row}" data-desc="自定操作栏">
                <a-form layout="inline" class="search-form" >
                    <a-form-item >
                        <a-button class="blue-btn" type="primary" @click="details(row)">详情</a-button>
                    </a-form-item>
                </a-form>
            </template>
        </commpVxeTable>
        <increase ref="increaseRef" @handleOk="handleOk"/>
        <a-modal
         :visible="firingVisibleShow" 
         title="添加此模板任务" 
         @ok="firingHandleOk" 
         :forceRender="true"
         @cancel="firingVisibleShow = false">
            <a-form >
                <a-form-item label="任务状态">
                    <compSelector
                        v-model="firingData.autoStopFlag" 
                        compType="Radio"
                        :defaultValue="firingData.autoStopFlag"
                        :options="[{label:'启动',value:'1'},{label:'暂停',value:'0'}]"
                    />
                </a-form-item>
            </a-form>
         </a-modal>
    </div>
</template>
<script>
import {typeInput, typeNumber, typeSelect, typeCheckbox, typeRadio} from '@/components/compSearchCriteria/ContractType'
import assessCheckApi from './service/api.js'
import increase from './increase.vue'
import { queryJobLogPageById} from './service/index'
import commpVxeTable from '@/components/commp-vxe-table/commp-vxe-table.vue'
import moment from 'moment'
import blobType from '@/common/blobType'
import compSelector from '@/components/compSelector/compSelector'
  export default {
    components:{
        commpVxeTable,
        increase,
        compSelector
    },
    
    data(){
        return{
            firingData:{
                id:'',
                autoStopFlag:'1',
            },
            firingVisibleShow:false,
            addEditParameter:{},
            formItem:[
                {
                    label: '任务名称',
                    model: 'frwmc',
                },{
                    label: '方法名称',
                    model: 'fmethod',
                },{
                    label: '开始时间',
                    model: 'startTime',
                    slotName:'startTime_time'
                },{
                    label: '结束时间',
                    model: 'endTime',
                    slotName:'endTime_time'
                }

            ],
            columnsVxe:[{ type: 'checkbox', width: 60 ,fixed: 'left',},{
                    title: '任务名称', //列头显示文字
                    field: 'frwmc',
                    fixed: 'left',
                },{
                    title: '方法名称', //列头显示文字
                    field: 'fmethod',
                },{
                    title: '执行状态', //列头显示文字
                    field: 'fzxzt',
                },{
                    title: '开始时间', //列头显示文字
                    field: 'fzxsj',
                },{
                    title: '结束时间', //列头显示文字
                    field: 'fjssj',
                },{
                    title: '操作',
                    field: 'id',
                    slots: {
                    // 使用插槽模板渲染
                    default: 'operation_btn',
                  },
                    fixed: 'right',
                    width:300,
                }],
            dataTableConfig:{
                api: assessCheckApi.list,
                rowId: 'id',
                // fywflcode:blobType.fywflcodeArr[blobType.menuType.indexOf(this.$route.name.substring(this.$route.name.indexOf('__'),this.$route.name.indexOf('_a')+2))],
                paramet:{
                }
            },
            specifyDateVal:'',
            isSpecifyDate:false,
            numFigure:1,
            numFigureVisible:false,
            currentReplicationId:'',
            selectedRowKeysArr:[],
            formItemData:{
                startTime:'',
                endTime:'',
            }
        }
    },
    
    methods:{
        //编辑
        details(val){
            this.$refs.increaseRef.visibleShow = true
            this.$refs.increaseRef.getData(val)
        },
        searchEvent(){//搜索
            this.dataTableConfig.paramet = {
                ...this.dataTableConfig.paramet,
                startTime:this.formItemData.startTime?moment(this.formItemData.startTime).format('YYYY-MM-DD') + ' 00:00:00':'',
                endTime:this.formItemData.endTime?moment(this.formItemData.endTime).format('YYYY-MM-DD') + ' 00:00:00':'',
            }
            //console.log(this.dataTableConfig.paramet)
        },
        resetEvent(){//重置
            this.dataTableConfig.paramet = {
                ...this.dataTableConfig.paramet,
            }
            this.formItemData.startTime = ''
            this.formItemData.endTime = ''

        },
        
    },

  }
</script>
<style lang="less">
.acceptance-registration-pages{
    .select-date-box{
        display: flex;
        flex-direction: column;
        span{
            color: #f5222d;
            font-size: 14px;
        }
    }
    .modal-btn-box{
        .ant-form-item-control{
            width: 175px !important;
        }
    }
    
}
</style>
<style scoped >
.observer-lbrary-pages{
    background: #fff;
}
.btn-box{
    display: flex;
    justify-content: flex-end;
}
.blue-btn{
    border: 1px solid #5ca3e5 !important;
    background-color: #5ca3e5 !important;
    color: #fff !important;
}
.red-btn{
    border: 1px solid #ed5565 !important;
    background-color: #ed5565 !important;
}




</style>